/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package co.com.entidad;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author 841756
 */
@Entity
@Table(name = "tblbancos")
@NamedQueries({
    @NamedQuery(name = "Tblbancos.findAll", query = "SELECT t FROM Tblbancos t"),
    @NamedQuery(name = "Tblbancos.findByCodBanco", query = "SELECT t FROM Tblbancos t WHERE t.codBanco = :codBanco"),
    @NamedQuery(name = "Tblbancos.findByNomBanco", query = "SELECT t FROM Tblbancos t WHERE t.nomBanco = :nomBanco"),
    @NamedQuery(name = "Tblbancos.findByCodSap", query = "SELECT t FROM Tblbancos t WHERE t.codSap = :codSap")})
public class Tblbancos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "cod_banco")
    private Integer codBanco;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 40)
    @Column(name = "nom_banco")
    private String nomBanco;
    @Size(max = 12)
    @Column(name = "cod_sap")
    private String codSap;
    @JoinColumn(name = "id_estado", referencedColumnName = "id_estado")
    @ManyToOne(optional = false)
    private TblEstado idEstado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "banco")
    private List<Tbldatosgenerales> tbldatosgeneralesList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "banco")
    private List<Tblcompania> tblcompaniaList;

    public Tblbancos() {
    }

    public Tblbancos(Integer codBanco) {
        this.codBanco = codBanco;
    }

    public Tblbancos(Integer codBanco, String nomBanco) {
        this.codBanco = codBanco;
        this.nomBanco = nomBanco;
    }

    public Integer getCodBanco() {
        return codBanco;
    }

    public void setCodBanco(Integer codBanco) {
        this.codBanco = codBanco;
    }

    public String getNomBanco() {
        return nomBanco;
    }

    public void setNomBanco(String nomBanco) {
        this.nomBanco = nomBanco;
    }

    public String getCodSap() {
        return codSap;
    }

    public void setCodSap(String codSap) {
        this.codSap = codSap;
    }

    public TblEstado getIdEstado() {
        return idEstado;
    }

    public void setIdEstado(TblEstado idEstado) {
        this.idEstado = idEstado;
    }

    public List<Tbldatosgenerales> getTbldatosgeneralesList() {
        return tbldatosgeneralesList;
    }

    public void setTbldatosgeneralesList(List<Tbldatosgenerales> tbldatosgeneralesList) {
        this.tbldatosgeneralesList = tbldatosgeneralesList;
    }

    public List<Tblcompania> getTblcompaniaList() {
        return tblcompaniaList;
    }

    public void setTblcompaniaList(List<Tblcompania> tblcompaniaList) {
        this.tblcompaniaList = tblcompaniaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codBanco != null ? codBanco.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tblbancos)) {
            return false;
        }
        Tblbancos other = (Tblbancos) object;
        if ((this.codBanco == null && other.codBanco != null) || (this.codBanco != null && !this.codBanco.equals(other.codBanco))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "" + nomBanco + "";
    }
    
}
